//index.js
//获取应用实例
const app = getApp()
const util = require('../../utils/util.js')

Page({
  data: {
    motto: '你好,欢迎使用微信小程序!',
    map: {},
    imgs: [ // 所有图片的URL列表，数组格式
      'https://bkimg.cdn.bcebos.com/pic/6609c93d70cf3bc767f142c3df00baa1cd112a28?x-bce-process=image/watermark,g_7,image_d2F0ZXIvYmFpa2UyMjA=,xp_5,yp_5',
      'https://bkimg.cdn.bcebos.com/pic/f11f3a292df5e0fed3fffdca516034a85fdf7211?x-bce-process=image/watermark,g_7,image_d2F0ZXIvYmFpa2UxMTY=,xp_5,yp_5',
      'https://bkimg.cdn.bcebos.com/pic/b21c8701a18b87d62dd7605f0a0828381e30fddd?x-bce-process=image/watermark,g_7,image_d2F0ZXIvYmFpa2UyMjA=,xp_5,yp_5',
      'https://bkimg.cdn.bcebos.com/pic/8d5494eef01f3a2984e33fee9725bc315c607ce3?x-bce-process=image/watermark,g_7,image_d2F0ZXIvYmFpa2UxNTA=,xp_5,yp_5',
      'https://bkimg.cdn.bcebos.com/pic/35a85edf8db1cb1374125c76d054564e92584b5f?x-bce-process=image/watermark,g_7,image_d2F0ZXIvYmFpa2UxNTA=,xp_5,yp_5',
      'https://bkimg.cdn.bcebos.com/pic/060828381f30e92436d92c3a44086e061d95f7b8?x-bce-process=image/watermark,g_7,image_d2F0ZXIvYmFpa2U5Mg==,xp_5,yp_5',
      'https://bkimg.cdn.bcebos.com/pic/42166d224f4a20a4f77488c998529822720ed052?x-bce-process=image/watermark,g_7,image_d2F0ZXIvYmFpa2UxNTA=,xp_5,yp_5',
      'https://bkimg.cdn.bcebos.com/pic/377adab44aed2e73898bb5338f01a18b87d6fa4a?x-bce-process=image/watermark,g_7,image_d2F0ZXIvYmFpa2UxMTY=,xp_5,yp_5',
      'https://bkimg.cdn.bcebos.com/pic/242dd42a2834349b800f9287c1ea15ce36d3bea3?x-bce-process=image/watermark,g_7,image_d2F0ZXIvYmFpa2U5Mg==,xp_5,yp_5',
      'https://bkimg.cdn.bcebos.com/pic/b03533fa828ba61e8aea7a244934970a304e59b0?x-bce-process=image/watermark,g_7,image_d2F0ZXIvYmFpa2UxNTA=,xp_5,yp_5',
      'https://bkimg.cdn.bcebos.com/pic/3812b31bb051f819f1c3ba41d2b44aed2f73e7d3?x-bce-process=image/watermark,g_7,image_d2F0ZXIvYmFpa2U5Mg==,xp_5,yp_5'
    ],

    artlist: [{
        imag: 'https://bkimg.cdn.bcebos.com/pic/6609c93d70cf3bc767f142c3df00baa1cd112a28?x-bce-process=image/watermark,g_7,image_d2F0ZXIvYmFpa2UyMjA=,xp_5,yp_5',
        art: "沂河",
        id: 0
      },
      {
        imag: 'https://bkimg.cdn.bcebos.com/pic/f11f3a292df5e0fed3fffdca516034a85fdf7211?x-bce-process=image/watermark,g_7,image_d2F0ZXIvYmFpa2UxMTY=,xp_5,yp_5',
        art: "东夷文化公园",
        id: 1
      },
      {
        imag: 'https://bkimg.cdn.bcebos.com/pic/b21c8701a18b87d62dd7605f0a0828381e30fddd?x-bce-process=image/watermark,g_7,image_d2F0ZXIvYmFpa2UyMjA=,xp_5,yp_5',
        art: "临沂生态园",
        id: 2
      },
      {
        imag: 'https://bkimg.cdn.bcebos.com/pic/8d5494eef01f3a2984e33fee9725bc315c607ce3?x-bce-process=image/watermark,g_7,image_d2F0ZXIvYmFpa2UxNTA=,xp_5,yp_5',
        art: "沂蒙路",
        id: 3
      },
      {
        imag: 'https://bkimg.cdn.bcebos.com/pic/35a85edf8db1cb1374125c76d054564e92584b5f?x-bce-process=image/watermark,g_7,image_d2F0ZXIvYmFpa2UxNTA=,xp_5,yp_5',
        art: "涑河万兴都",
        id: 4
      },
      {
        imag: 'https://bkimg.cdn.bcebos.com/pic/060828381f30e92436d92c3a44086e061d95f7b8?x-bce-process=image/watermark,g_7,image_d2F0ZXIvYmFpa2U5Mg==,xp_5,yp_5',
        art: "金雀山路沂河大桥",
        id: 5
      },
      {
        imag: 'https://bkimg.cdn.bcebos.com/pic/42166d224f4a20a4f77488c998529822720ed052?x-bce-process=image/watermark,g_7,image_d2F0ZXIvYmFpa2UxNTA=,xp_5,yp_5',
        art: "蒙山云海",
        id: 6
      }, {
        imag: 'https://bkimg.cdn.bcebos.com/pic/377adab44aed2e73898bb5338f01a18b87d6fa4a?x-bce-process=image/watermark,g_7,image_d2F0ZXIvYmFpa2UxMTY=,xp_5,yp_5',
        art: "王羲之故居",
        id: 7
      }, {
        imag: 'https://bkimg.cdn.bcebos.com/pic/242dd42a2834349b800f9287c1ea15ce36d3bea3?x-bce-process=image/watermark,g_7,image_d2F0ZXIvYmFpa2U5Mg==,xp_5,yp_5',
        art: "沂蒙山小调诞生地",
        id: 8
      }, {
        imag: 'https://bkimg.cdn.bcebos.com/pic/b03533fa828ba61e8aea7a244934970a304e59b0?x-bce-process=image/watermark,g_7,image_d2F0ZXIvYmFpa2UxNTA=,xp_5,yp_5',
        art: "临沂大学图书馆",
        id: 9
      }, {
        imag: 'https://bkimg.cdn.bcebos.com/pic/3812b31bb051f819f1c3ba41d2b44aed2f73e7d3?x-bce-process=image/watermark,g_7,image_d2F0ZXIvYmFpa2U5Mg==,xp_5,yp_5',
        art: "临沂糁汤",
        id: 10
      }
    ]

  },
  onLoad: function() {

  },
  getUserInfo: function(e) {

  },

  previewImg: function() {
    wx.previewImage({
      current: this.data.imgs[0],
      urls: this.data.imgs,
      success: function(res) {
        console.log(res)
      }
    })
  },

  onBtn1Click: function() {
    wx.showToast({
      title: '点击按钮1',
      icon: 'success',
      duration: 2000
    })
  },


  onBtn2Click: function() {
    wx.showToast({
      title: '加载中',
      icon: 'loading',
      duration: 2000
    })
  },

  // 点击查看天气
  onCheckWeather: function() {
    util.navigateToWeather();
  },

  // 点击查看地图
  onCheckMap: function () {
    wx.navigateTo({
      url: '/pages/map/map',
    })
  },

  // 点击查看图片
  onImgClick: function(e) {
    console.log(e);
    let index = e.currentTarget.dataset.index;
    console.log('index = ' + index);

    wx.previewImage({
      current: this.data.imgs[index],
      urls: this.data.imgs,
      success: function (res) {
        console.log(res)
      }
    })

  },

})